package dao;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import utilClasses.ListaTipovaSaobracaja;;


public class daoTipSaobracaja {
	
	public static ListaTipovaSaobracaja dajTipoveSaobracaja() throws SQLException{
		Connection c = daoKonekcija.dajKonekciju();
	ListaTipovaSaobracaja rez=new ListaTipovaSaobracaja();
	String iskaz = "SELECT nazivSaobracaja FROM tipsaobracaja";
	try {
		Statement stmt = c.createStatement();
		ResultSet rs=stmt.executeQuery(iskaz);
		while (rs.next()) {
	    	String naziv=rs.getString(1);
	        rez.getVrijednost().add(new String(naziv)); 
	        }
		rs.close();
	    stmt.close();
	    c.close();
	    return rez;
		
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		if(c!=null)c.close();
		e.printStackTrace();
	}
	return rez; 
}	

}
